package com.xjm;

import com.xjm.service.HelloService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import java.util.Arrays;

/**
 * @author jaymin
 * 2020/11/26 17:02
 */
public class FirstDemo {
	public static void main(String[] args) {
		String xmlPath = "D:\\Spring\\spring-framework-5.1.x\\spring-demo\\src\\main\\resources\\spring\\spring-config.xml";
		ApplicationContext applicationContext = new FileSystemXmlApplicationContext(xmlPath);
		HelloService helloService = ((HelloService) applicationContext.getBean("helloService"));
		Arrays.stream(applicationContext.getBeanDefinitionNames()).forEach(System.out::println);
		String hello = helloService.hello();
		System.out.println(hello);
	}
}
